#ifndef DYNAMICARRAY_H
#define DYNAMICARRAY_H
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

// 万能动态数组
#define ElementType void*


//结构体声明
struct dynamicarray;
typedef struct dynamicarray DArray;

//初始化
DArray* InitDArray();

//
void InsertDArray(DArray* a,ElementType element);

void PrintDArray(DArray *a,void (*print)(ElementType));

ElementType FindByElement(DArray *a,ElementType value,bool (*compare)(ElementType,ElementType));

//void DeleteElement(DArray *a,ElementType value,bool (*compare)(ElementType,ElementType));
ElementType RemoveDArray(DArray *a,ElementType value,bool (*compare)(ElementType,ElementType));

void MyFastSort(ElementType *a,int start,int end,bool (*compare)(ElementType,ElementType));

ElementType BinarySearch(DArray *a,ElementType value ,int(*compare)(ElementType,ElementType));


void FastSort(DArray *a,bool (*compare)(ElementType,ElementType));

//释放
void ClearDArray(DArray *a,void (*clear)(ElementType));

























#endif